package com.ruoyi.ucenter.config;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author : 张怀秋
 **/
@Configuration
public class BeanCode {
    @Resource
    private CodeConfig codeConfig;

    @Bean
    @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) //开启多例
    public Map<String, String> getCodeBean() {
        Map<String, String> map = new HashMap<>();
        map.put("host", codeConfig.getHost());
        map.put("AppCode", codeConfig.getAppCode());
        map.put("method", codeConfig.getHost());
        map.put("path", codeConfig.getHost());
        return map;
    }
}
